<?php $this->load->view('common/header');?>
<body>
<?php $this->load->view('common/user_center');?>
<div class="main_box">
    <?php $this->load->view('common/menu');?>
    <div class="right_box f_r">
    	<div class="title">
        	<span class="f_l">销售贷账单</span>
        </div>
        <div class="loan_data">
        	<span class="f_l">
            	<em id="fenqi_money"><?php echo $cur_month_loan;?></em>
                <p>出账单日：<?php echo date("Y",time());?>年<?php echo date("m",time());?>月<?php echo $endday;?>日</p>
            </span>
            <span class="f_r">
            	<em>销售贷分期</em>
                <p>1.消费额度按日计算，月息为1.5-2%之间。</p>
                <p>2.消费额度可和信用卡一样申请3、6、9期进行还款，并可循环使用。</p>
                <p>3.授信额度根据使用记录每三个月进行更新</p>
<!--                <a href="javascript:;" id="fenqi" val="--><?php //echo site_url(V_URL.'user/user_loan_stage');?><!--">申请分期</a>-->
            </span>
        </div>
    	<div class="title">
        	<span class="f_l">分期记录</span>
        </div>
        <div class="loan_table">
        	<table>
            	<tr>
                	<th class="w1">类型</th>
                    <th>应还金额</th>
                    <th>还款日期</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                <?php if($loan_bil){ ?>
                    <?php foreach ($loan_bil as $key => $val) {?>
                    <tr>
                        <td class="w1">账单分期</td>
                        <td><?php echo $val['per_stage_money'];?></td>
                        <td><?php echo date("Y-m-d",strtotime($val['back_date']));?> </td>
                        <td>
                            <?php if($val['is_return'] == 0){?>
                                <span>未还</span>
                            <?php } ?>
                            <?php if($val['is_return'] == 1){?>
                                <span>已还</span>
                            <?php } ?>
                        </td>
                        <td>
                            <?php if($val['is_return'] == 0){?>
                                <a href="javascript:;" id="payBack" val="<?php echo site_url(V_URL.'user/user_loan_stage');?>">立即还款</a>
                            <?php } ?>
                            <?php if($val['is_return'] == 1){?>
                                <span>--</span>
                            <?php } ?>
                        </td>
                    </tr>
                    <?php } ?>
                <?php } ?>
            </table>
        </div>
    </div>
</div>
<!--]] user -->
<!-- coypright [[-->
<?php $this->load->view('common/footer');?>
<!--]] coypright -->
<script>
    var can_fenqi = "<?php echo $can_fenqi;?>";
    $("#fenqi").click(function () {
        if(can_fenqi == 1){
            window.location.href = $(this).attr("val");
        }else if(can_fenqi == 3){
            layer.alert('0元账单不需要分期', {
                icon: 4,
                skin: 'layer-ext-moon'
            });
            return false;
        }else{
            layer.alert('月底账单日才能申请分期哦', {
                icon: 4,
                skin: 'layer-ext-moon'
            });
            return false;
        }
    });
    $("#payBack").click(function () {
        layer.alert('自助还款功能开发中，敬请期待', {
            icon: 4,
            skin: 'layer-ext-moon'
        });
    });
</script>
</body>
</html>
